class Solution(object):
    def numOfSubarrays(self, arr):
        d = {0: 1, 1: 0}
        now = 0
        ans = 0
        for num in arr:
            now = (now + num) % 2
            ans += d[1 - now]
            d[now] += 1
        return ans % (10 ** 9 + 7)